using System.Collections.Generic;
using System.Diagnostics;

namespace BSDS.Core.Infrastructure.Logging
{
    public class LoggerFactory
    {
        private static readonly TraceSource TraceSource = new TraceSource("BSDS");

        private readonly List<ILogConsumer> defaultConsumers;

        public LoggerFactory()
        {
            defaultConsumers = new List<ILogConsumer>();
        }

        public Logger Create(string sourceName)
        {
            return Create(sourceName, TraceSource);
        }

        public Logger Create(string sourceName, TraceSource source)
        {
            var logger =  new Logger(sourceName, source, defaultConsumers);
            
            return logger;
        }

        public void AddDefaultLogConsumer(ILogConsumer consumer)
        {
            defaultConsumers.Add(consumer);
        }
    }
}